export function route(handle, pathName, request, response) {
	console.log('About to route a request for ' + pathName)

	if (pathName.indexOf('/static/') === 0) {
		const resource = pathName.split('/static/')[1]
		handle['/static'](response, resource)
	} else {
		if (typeof handle[pathName] === 'function') {
			handle[pathName](request, response)
		} else {
			console.log('No request handler found for ' + pathName)
			response.writeHead(404, { 'Content-Type': 'text/plain' })
			response.write('404 not found')
			response.end()
		}
	}
}
